﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="CSWeb.easyui_test._default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script src="/map-easyui/jquery.fileupload/js/vendor/jquery.ui.widget.js"></script>
    <script src="/map-easyui/jquery.fileupload/js/jquery.iframe-transport.js"></script>
    <script src="/map-easyui/jquery.fileupload/js/jquery.fileupload.js"></script>
    <script type="text/javascript">
        $(function () {

        });
    </script>
    <input type="text" id="dbMonth" />
    <p></p>
    <div id="findbox" class="findbox"></div>
    <p></p>
    <div id="dg"></div>
    <p></p>
    <input id="file" type="file" />
    <script type="text/javascript">
        $(function () {
            //月份选择框
            var dbMonth = $('#dbMonth').datebox({
                showDays: false,
                shortcut: true
            });

            //查询框
            var findbox = $('#findbox').findbox({
                isAdvInherit: true, //高级查询直接继承低级查询
                normal: [[
                    { field: 'UserName', title: '用户名' }
                ]]
            });

            //列表
            var dg = $('#dg').datagrid({
                queryParams: {
                    Command: JSON.stringify({
                        File: 'easyui-test.default',    //SQL文件地址
                        Order: 'UserName'   //默认排序方式
                    })
                },
                pagination: true,
                showFooter: true,   //页脚，可设置自动合计列
                pageSize: 10,
                fit: false,
                fitColumns: true,
                columns: [[
                    { field: 'UserName', title: '用户名', width: 150, sortable: true, sortName: 'UserName' },    //排序功能支持
                    {
                        field: 'Total', title: '合计', width: 50, sortable: true, dataType: 'number',
                        settings: function () {
                            return JSON.stringify({
                                Formula: "D1+E1+F1"
                            });
                        }
                    },
                    { field: 'Age', title: '年龄1', width: 50, sortable: true },
                    { field: 'Age', title: '年龄2', width: 50, sortable: true },
                    { field: 'Age', title: '年龄3', width: 50, sortable: true }
                    //自动合计功能，数字格式化功能。
                ]],
                toolbar: [
                    {
                        text: '新建',
                        iconCls: 'icon-add',
                        handler: function () {
                            $.pushWindow().dialog({
                                href: 'edit.aspx',
                                queryParams: {
                                    oid: '<%=Guid.Empty %>'
                                },
                                processCallback: function (p) {
                                    dg.datagrid('reload');
                                }
                            });
                        }
                    },
                    {
                        text: '编辑',
                        iconCls: 'icon-edit',
                        selectValid: 1,
                        handler: function (row) {
                            alert(row.UserName);
                        }
                    },
                    {
                        text: '删除',
                        iconCls: 'icon-remove',
                        selectValid: 1,
                        handler: function (row) {
                            $.mapex.deleteEntity(row.UserGUID, "Mysoft.Test.Entity.TUser");
                            dg.datagrid('reload');
                        }
                    }
                ]
            });
        });

        //上传按钮
        $('#file').fileupload({
            url: '/path/to/upload/handler.json',
            sequentialUploads: true
        });
    </script>
</asp:Content>
